
function wopen(url,target)
{
	var style="titlebar=yes,location=yes,menubar=yes,toolbar=yes,scrollbars=yes,status=yes,resizable=yes,fullscreen=yes,width="+eval(document.body.offsetWidth);
	window.open(url,target,style);
}


function getOffsetBySide(id,side)
{
	var obj=document.getElementById(id);
	var pos=0;
	while (obj!==null)
	{
		pos+=obj["offset"+side];
	 	obj=obj.offsetParent;
	}
	return pos;
}

function selectAll(obj)
{
	var inputs=document.getElementsByTagName("input");
	for (var i=0;i<inputs.length;i++)
	{
		var input=inputs.item(i);
		if (input.type=="checkbox" && input.id=="")
		{
			input.checked=obj.checked;
		}
	}
}

function checkRange()
{
	var inputs=document.getElementsByTagName("input");
	var ids="";
	for (var i=0;i<inputs.length;i++)
	{
		var input=inputs.item(i);
		if (input.type=="checkbox" && input.id=="" && input.checked)
		{
			ids+="," + input.value;
		}
	 	if (ids.substr(0,1)==",")
	 	{
	 		ids=ids.substr(1);
	 	}
	}
	return ids;
}

function mousemove(obj,bgColor)
{
   	cs  =  obj.children;
   	for(var i=0;i<cs.length;i++)
   	{
   		cs[i].style.backgroundColor=bgColor;
   	}
}

function changeStyle(obj,bgColor,color,borders)
{
    obj.style.backgroundColor=bgColor;
    obj.style.color=color;
    obj.style.border=borders;
}

function nextElement()
{
	if (event.keyCode==13)
	{
		event.keyCode=9;
	}
}

function today()
{
	var day=new Date();
	var year=day.getFullYear();
	var month=formatDate(day.getMonth()+1);
	var date=formatDate(day.getDate());
	
	return ""+year+month+date;
}

function formatDate(param)
{
	return (param<10)?"0"+param:param;
}

function password(len)
{
	var result="";
	for (var i=0;i<len;i++)
	{
		result+=Math.floor(Math.random()*10);
	}
	return result;
}

function logoff()
{
	location="/Archive";
}

function trim(str)
{
	var result = str;
	while (result.indexOf(" ")>=0)
	{
		result = result.replace(" ","");
	}
	return result;
}
